-
Notifications
You must be signed in to change notification settings - Fork 981
Option for not inserting primary keys into Sql Server tables #1343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Option for not inserting primary keys into Sql Server tables #1343
Conversation
… use them for UPDATE
|
@Tanish0019 Is it possible to get an ETA or other information on the likelihood of this getting merged? The changes look good to me and judging from StackOverflow and GitHub Issues - it would benefit a large number of people. |
Hi @AnthonyWhitaker, yes looks like a valid issue. I will try to get to reviewing it soon. |
🎉 All Contributor License Agreements have been signed. Ready to merge. |
@Tanish0019 signed the new CLA and merged all conflicts |
Problem
Inserting values into IDENTITY columns on SQL Server (MS) will result in SQL Error:
insert explicit value for identity column in table 'tablename' when IDENTITY_INSERT is set to OFF
The are valid scenarios where you don´t want to (or cannot) alter the target tables of database just to "make kafka-connect happy".
But you might need to include the primary key in you kafka-connect config because you have to include it for the upsert mode/UPDATE case.
Related to #1287 and #837
Solution
Added option mssql.insert.primary.keys which defaults to true.
If set to false the INSERT will omit the primary key columns. This allows allows the database to create its own primary keys, if they are configured with IDENTITY(n,n) for autoincremental keys. This works for mode=insert and mode=upsert
Does this solution apply anywhere else?
If yes, where?
Test Strategy
Testing done:
Release Plan
This feature is non-breaking by design. Given there is no bug, it will not change any existing behavior. So it can be released without any migration effort.